package day12_coll.demo05_comparable;

import java.util.TreeSet;

public class Test {
    public static void main(String[] args) {
        Student zs = new Student("张三", 30);
        Student ls = new Student("李四", 28);
        Student ww = new Student("王五", 29);
        Student zl = new Student("赵六", 30);
        TreeSet<Student> students = new TreeSet<>();
        students.add(zs);
        students.add(ls);
        students.add(ww);
        students.add(zl);
        for (Student student : students) {
            System.out.println(student.getName()+":"+student.getAge());
        }
    }
}
